home *** CD-ROM | disk | FTP | other *** search
-
-
-
- LLLLIIIIBBBBPPPPEEEERRRRFFFFEEEEXXXX((((3333CCCC)))) LLLLIIIIBBBBPPPPEEEERRRRFFFFEEEEXXXX((((3333CCCC))))
-
-
-
- NNNNAAAAMMMMEEEE
- lllliiiibbbbppppeeeerrrrffffeeeexxxx, ssssttttaaaarrrrtttt____ccccoooouuuunnnntttteeeerrrrssss, rrrreeeeaaaadddd____ccccoooouuuunnnntttteeeerrrrssss, pppprrrriiiinnnntttt____ccccoooouuuunnnntttteeeerrrrssss, pppprrrriiiinnnntttt____ccccoooossssttttssss,
- llllooooaaaadddd____ccccoooossssttttssss - A procedural interface to processor event counters
-
- CCCC SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
- iiiinnnntttt ssssttttaaaarrrrtttt____ccccoooouuuunnnntttteeeerrrrssss(((( iiiinnnntttt eeee0000,,,, iiiinnnntttt eeee1111 ))));;;;
- iiiinnnntttt rrrreeeeaaaadddd____ccccoooouuuunnnntttteeeerrrrssss(((( iiiinnnntttt eeee0000,,,, lllloooonnnngggg lllloooonnnngggg ****cccc0000,,,, iiiinnnntttt eeee1111,,,, lllloooonnnngggg lllloooonnnngggg ****cccc1111))));;;;
- iiiinnnntttt pppprrrriiiinnnntttt____ccccoooouuuunnnntttteeeerrrrssss(((( iiiinnnntttt eeee0000,,,, lllloooonnnngggg lllloooonnnngggg cccc0000,,,, iiiinnnntttt eeee1111,,,, lllloooonnnngggg lllloooonnnngggg cccc1111))));;;;
- iiiinnnntttt pppprrrriiiinnnntttt____ccccoooossssttttssss(((( iiiinnnntttt eeee0000,,,, lllloooonnnngggg lllloooonnnngggg cccc0000,,,, iiiinnnntttt eeee1111,,,, lllloooonnnngggg lllloooonnnngggg cccc1111))));;;;
- iiiinnnntttt llllooooaaaadddd____ccccoooossssttttssss((((cccchhhhaaaarrrr ****CCCCoooossssttttFFFFiiiilllleeeeNNNNaaaammmmeeee))));;;;
-
-
- FFFFOOOORRRRTTTTRRRRAAAANNNN SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
- IIIINNNNTTTTEEEEGGGGEEEERRRR****8888 cccc0000,,,, cccc1111
- IIIINNNNTTTTEEEEGGGGEEEERRRR eeee0000,,,, eeee1111
- CCCCHHHHAAAARRRRAAAACCCCTTTTEEEERRRR((((****nnnn)))) CCCCoooossssttttFFFFiiiilllleeeeNNNNaaaammmmeeee
- IIIINNNNTTTTEEEEGGGGEEEERRRR****4444 ffffuuuunnnnccccttttiiiioooonnnn ssssttttaaaarrrrtttt____ccccoooouuuunnnntttteeeerrrrssss(((( eeee0000,,,, eeee1111 ))))
- IIIINNNNTTTTEEEEGGGGEEEERRRR****4444 ffffuuuunnnnccccttttiiiioooonnnn rrrreeeeaaaadddd____ccccoooouuuunnnntttteeeerrrrssss(((( eeee0000,,,, cccc0000,,,, eeee1111,,,, cccc1111 ))))
- IIIINNNNTTTTEEEEGGGGEEEERRRR****4444 ffffuuuunnnnccccttttiiiioooonnnn pppprrrriiiinnnntttt____ccccoooouuuunnnntttteeeerrrrssss(((( eeee0000,,,, cccc0000,,,, eeee1111,,,, cccc1111 ))))
- IIIINNNNTTTTEEEEGGGGEEEERRRR****4444 ffffuuuunnnnccccttttiiiioooonnnn pppprrrriiiinnnntttt____ccccoooossssttttssss(((( eeee0000,,,, cccc0000,,,, eeee1111,,,, cccc1111 ))))
- IIIINNNNTTTTEEEEGGGGEEEERRRR****4444 ffffuuuunnnnccccttttiiiioooonnnn llllooooaaaadddd____ccccoooossssttttssss(((( CCCCoooossssttttFFFFiiiilllleeeeNNNNaaaammmmeeee ))))
-
- DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
- These routines provide simple access to the hardware event counters. The
- arguments eeee0000 and eeee1111 are iiiinnnntttt types specifying which events to count. For
- descriptions of the counters themselves, see the ppppeeeerrrrffffeeeexxxx(1) or the
- rrrr11110000kkkk____ccccoooouuuunnnntttteeeerrrrssss(5) man page.
-
- The counts are returned in the lllloooonnnngggg lllloooonnnngggg arguments cccc0000 and cccc1111. The
- pppprrrriiiinnnntttt____ccccoooouuuunnnntttteeeerrrrssss routine prints the counts to standard error. Two events
- which mmmmuuuusssstttt be counted on the same hardware counter will cause a
- conflicting counters error. The arguments _e_0 and _e_1 can be overridden by
- setting the environment variables TTTT5555____EEEEVVVVEEEENNNNTTTT0000 and TTTT5555____EEEEVVVVEEEENNNNTTTT1111. Calls to
- ssssttttaaaarrrrtttt____ccccoooouuuunnnntttteeeerrrrssss implicitly zero out the internal software counters before
- starting them, while rrrreeeeaaaadddd____ccccoooouuuunnnntttteeeerrrrssss implicitly stops the counters after
- reading them. Thus if you want to accumulate counts over multiple
- start/read calls, you must save out the counts and do the accumulation
- yourself. Each of these incurs a typical system call overhead which can
- amount to a few hundred microseconds per start/stop call pair. The
- pppprrrriiiinnnntttt____ccccoooouuuunnnntttteeeerrrrssss procedure is just a formatting convenience and has no
- effect on the state of the counters.
-
- TTTTIIIIMMMMEEEE EEEESSSSTTTTIIIIMMMMAAAATTTTEEEESSSS AAAANNNNDDDD CCCCOOOOSSSSTTTT TTTTAAAABBBBLLLLEEEESSSS
- The pppprrrriiiinnnntttt____ccccoooossssttttssss routine prints the counts together with approximate time
- estimates as described for ppppeeeerrrrffffeeeexxxx. The llllooooaaaadddd____ccccoooossssttttssss procedure allows a
- cost table to be loaded from a file. Cost ranges reflect both the width
- of the cost distribution and uncertainty in the degree of overlap. Costs
- for different events are not exclusive due to the overlap of one type of
- event with others. By default a table of costs for each event
- appropriate to the host system is used. If the file ////eeeettttcccc////ppppeeeerrrrffffeeeexxxx....ccccoooossssttttssss is
- present, it is used instead. If a table is loaded using load_costs, it is
- used instead. Partial tables may be used; the remaining entries taking
-
-
-
- PPPPaaaaggggeeee 1111
-
-
-
-
-
-
- LLLLIIIIBBBBPPPPEEEERRRRFFFFEEEEXXXX((((3333CCCC)))) LLLLIIIIBBBBPPPPEEEERRRRFFFFEEEEXXXX((((3333CCCC))))
-
-
-
- the appropriate default values. The format of the cost table and how to
- dump the default cost table for the current system are described in the
- perfex manpage.
-
- DDDDIIIIAAAAGGGGNNNNOOOOSSSSTTTTIIIICCCCSSSS
- Normal completion returns a positive integer, the ggggeeeennnneeeerrrraaaattttiiiioooonnnn nnnnuuuummmmbbbbeeeerrrr.
- Negative return values signal an error. The underlying operating system
- counter interface may produce other errors. Among these are indications
- that the counter resource is in use, possibly because of monitoring by
- another user on the system (with root privileges) in system mode. The
- generation numbers increment on a per-process basis each time the
- counters are enabled or stopped. Because the counters may have been used
- by a supervisor-privilege process after being enabled by the user with
- start_counters, but before being read by read_counters, all correct uses
- of the interface must check that the generation number returned by
- read_counters matches the generation number from the corresponding
- start_counters, for each process. For example, To collect instruction
- and data scache miss counts on a program normally executed by
- int e0,e1
- long long c0,c1;
- int gen_start, gen_read
-
- /* ... set e0 and e1 ... */
-
- if((gen_start=start_counters(e0,e1)) < 0) {
- perror("start_counters");
- }
-
- /* user code */
-
- if((gen_read=read_counters(e0,&c0,e1,&c1))<0) {
- perror("read_counters");
- }
-
- if(gen_read != gen_start) {
- perror("lost counters!, aborting...");
- exit(1);
- }
-
- /* do something with c0,c1 */
- illustrates correct use. Counter measurements are typically not precisely
- reproducible for most events. For example, counts of cache misses depend
- on the change in the cache population due to other processes when the
- target process is not running. Invalidation and intervention counts may
- depend on the temporal ordering of memory accesses by different
- processors, which is not guaranteed. Issued instruction counts depend on
- the R10000's dynamic scheduling of instructions, which in turn can depend
- on the pattern of instruction cache misses. Since the cache misses are
- affected by the runtime environment as noted above, this count is also
- not precisely reproducible. In almost all cases, however, while the
- exact count may not be reproducible, the amount of time attributable to
- any fluctuations is a tiny fraction of the execution time. Conversely,
-
-
-
- PPPPaaaaggggeeee 2222
-
-
-
-
-
-
- LLLLIIIIBBBBPPPPEEEERRRRFFFFEEEEXXXX((((3333CCCC)))) LLLLIIIIBBBBPPPPEEEERRRRFFFFEEEEXXXX((((3333CCCC))))
-
-
-
- any event which accounts for an important fraction of the execution time
- will have a count with small relative fluctuations from run to run.
-
- RRRREEEESSSSTTTTRRRRIIIICCCCTTTTIIIIOOOONNNNSSSS
- This interface is not reentrant or (pthread) thread-safe. The
- start_counters, read_counters, print_counters and print_costs, routines
- can be called by individual sproc threads. However there is only
- provision for a single global cost table, so load_costs should be called
- only in a sequential region, and that cost table must be applied to the
- counts from all threads.
-
- FFFFIIIILLLLEEEESSSS
- ////uuuussssrrrr////lllliiiibbbb////lllliiiibbbbppppeeeerrrrffffeeeexxxx....ssssoooo ////uuuussssrrrr////lllliiiibbbb33332222////lllliiiibbbbppppeeeerrrrffffeeeexxxx....ssssoooo ////uuuussssrrrr////lllliiiibbbb66664444////lllliiiibbbbppppeeeerrrrffffeeeexxxx....ssssoooo
-
- DDDDEEEEPPPPEEEENNNNDDDDEEEENNNNCCCCIIIIEEEESSSS
- These procedures are only available on systems with hardware performance
- counters (systems with R10000 or R12000 processors). Use on systems with
- mixed processor types will have undefined results in systems with mixed
- processor types.
-
- Manipulating the counters with these routines and simultaneously through
- ppppeeeerrrrffffeeeexxxx or the OS counter interface ioctl procedures can produce an error
- if, for example, the counters are enabled twice without being released in
- the interim.
-
- SSSSEEEEEEEE AAAALLLLSSSSOOOO
- ppppeeeerrrrffffeeeexxxx(1), rrrr11110000kkkk____ccccoooouuuunnnntttteeeerrrrssss(5), aaaabbbbiiii(5), mmmmiiiippppssss4444(5), mmmmiiiippppssss3333(5)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- PPPPaaaaggggeeee 3333
-
-
-
-